﻿using SocketControl.Protocol.Http.Model.General;
using System.Collections.Generic;

namespace SocketControl.Protocol.Http.Model
{
    public class Request : GeneralHeadModel
    {
        #region Fileds
        public RequestMethod Method;
        public string Resource;
        public HttpVersion HttpVersion;

        public IList<Model.Item> Accept = new List<Model.Item>();
        public string Accept_Charset;
        public string Accept_Encoding;
        public string Accept_Language;
        public string Accept_Ranges;
        public string Authorization;
        public string Cookie;
        public string Expect;
        public string From;
        public string Host;
        public string If_Match;
        public string If_Modified_Since;
        public string If_None_Match;
        public string If_Range;
        public string If_Unmodified_Since;
        public string Max_Forwards;
        public string Proxy_Authorization;
        public string Range;
        public string Referer;
        public string TE;
        public string User_Agent;
        public string Warning;
        #endregion

        #region Method
        public Request() { }
        public Request(GeneralHeadModel param)
        {
            Cache_Control = param.Cache_Control;
            Connection = param.Connection;
            Date = param.Date;
            Pragma = param.Pragma;
            Transfer_Encoding = param.Transfer_Encoding;
            Via = param.Via;
            Upgrade = param.Upgrade;
            Content_Length = param.Content_Length;
            Content_Type = param.Content_Type;
            Content_Encoding = param.Content_Encoding;
        }

        public Model.GeneralHeadModel GetGeneralBody()
        {
            return new GeneralHeadModel()
            {
                Cache_Control = this.Cache_Control,
                Connection = this.Connection,
                Date = this.Date,
                Pragma = this.Pragma,
                Transfer_Encoding = this.Transfer_Encoding,
                Via = this.Via,
                Upgrade = this.Upgrade,
                Content_Length = this.Content_Length,
                Content_Type = this.Content_Type,
                Content_Encoding = this.Content_Encoding
            };
        }
        #endregion
    }
}
